package com.hckjsec.common.config;

import com.hckjsec.common.filter.DecodeFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DecodeFilterConfig {

    @Bean
    public DecodeFilter decodeFilter(){
        return new DecodeFilter();
    }

    @Bean
    public FilterRegistrationBean signFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(decodeFilter());//添加过滤器
        registration.addUrlPatterns("/*");//设置过滤路径，/*所有路径
        registration.setName("decodeFilter");//设置优先级
        registration.setOrder(1);//设置优先级
        return registration;
    }
}